package ru.jexp.rcp.supply.n.commands.state;

import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ui.ISources;

import ru.jexp.rcp.supply.beans.project.dvs.sostavizdelia.TreePathMerge;

public abstract class StateSostavIzdelia extends AJExpProviderState implements ISelectionChangedListener
{
	protected abstract void updateEnabled(TreePathMerge path, TreeViewer viewer);
	
	public StateSostavIzdelia()
	{
		super();
	}

	@Override
	public void selectionChanged(SelectionChangedEvent event)
	{
		StructuredSelection selection = (StructuredSelection) event.getSelection();
		updateEnabled(((TreePathMerge) selection.getFirstElement()), (TreeViewer)event.getSource());
	}

	@Override
	public int getPriorityLevel()
	{
		return ISources.ACTIVE_SHELL;
	}
}
